package com.study.model.mdao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.study.model.pojo.PurApp;
import com.study.model.pojo.PurAppDetail;

@Mapper
public interface PurAppMapper {

	// 查询pur_app最大id
	public String findPurAppMaxId();

	// 查询pur_app_details最大id
	public String findPurAppDetailMaxId();

	// @Select("select * from pur_app")
	// 动态SQL条件查询
	public List<PurApp> findPurApps(@Param("theme") String theme, @Param("applicant") String applicant,
			@Param("appdept") String appdept, @Param("state") int state);

	// 根据id查询采购申请主表信息
	public Map<String, Object> findPurApp(@Param("appId") String appId);

	// 根据id查询采购申请详细信息
	public List<Map<String, Object>> findAppDetailsAll(@Param("appId") String appId);

	// 删除详情表
	// @Delete("delete from pur_app_details where app_id=#{appId}")
	public void deleteAppDetail(String appId);

	// 删除申请表
	// @Delete("delete from pur_app where app_id=#{appId}")
	public void deletePurApp(String appId);

	// 提交审批
	public void updateStateToOne(String appId);

	// 修改
	public void updatePurApp(String id);

	// 添加采购申请表
	public int savePurApp(PurApp purApp);

	// 批量添加申请明细表
	public void saveAppDetails(List<PurAppDetail> purAppDetails);

	// 单个添加明细
	public void saveAppDetail(Map map);

}
